import { axiosMock, delayFn } from '@/services/axiosMock'
import type { IEventTemplateEnableRes } from './api'

// 根据接口定义提供示例数据
const mockList: IEventTemplateEnableRes[] = [
  {
    enableFlag: 1,
    eventTemplateId: 1001,
    firstLines: [1], // OCEAN
    locationType: 1, // 始发地
    messageType: 1, // Information
    reasonCode: 'A001',
    shipTrackRequire: 1, // 必须
    status: 11, // 主状态-待处理/已创建（示例）
    statusCode: 'CREATED',
    statusGroup: 1, // 主状态
    tailLines: [2], // 卡车
    templateCn: '运单已创建',
    templateEn: 'Shipment Created',
    timestampDescription: '创建时间',
    updateAt: '2025-10-31 09:00:00',
    visibleFlag: 1,
  },
  {
    enableFlag: 1,
    eventTemplateId: 1002,
    firstLines: [1],
    locationType: 2, // 集货仓
    messageType: 1,
    reasonCode: 'A002',
    shipTrackRequire: 2, // 可选
    status: 12, // 主状态-待发货（示例）
    statusCode: 'GOODS_COLLECTED',
    statusGroup: 1,
    tailLines: [2],
    templateCn: '货物已收取',
    templateEn: 'Goods Collected',
    timestampDescription: '收货时间',
    updateAt: '2025-10-31 10:20:00',
    visibleFlag: 1,
  },
  {
    enableFlag: 1,
    eventTemplateId: 1003,
    firstLines: [2], // AIR
    locationType: 3, // 起运港
    messageType: 2, // Notification
    reasonCode: 'C021',
    shipTrackRequire: 1,
    status: 23, // 报关-申报中
    statusCode: 'CUSTOMS_DECLARATION_SUBMITTED',
    statusGroup: 2, // 报关
    tailLines: [1],
    templateCn: '报关单据已提交',
    templateEn: 'Customs Declaration Submitted',
    timestampDescription: '报关时间',
    updateAt: '2025-10-31 11:35:00',
    visibleFlag: 0,
  },
]

// 注册接口 mock
axiosMock('default', mock => {
  mock.onPost('/tmsapi/event_template/enable/list').reply(
    delayFn<IEventTemplateEnableRes[]>(300, () => ({
      success: true,
      errorMessage: null,
      code: '0',
      data: mockList,
    })),
  )
})
